﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WPFMediaKit.DirectShow.Controls;

namespace WindowsMediaCapture
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

            //获取摄像头设备列表
            if (MultimediaUtil.VideoInputDevices.Any())
            {
                combobox_CameraDeviceList.ItemsSource = MultimediaUtil.VideoInputNames;
            }
        }

        /// <summary>
        /// 摄像头设备列表选择
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void combobox_CameraDeviceList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            cameraCaptureElement.VideoCaptureDevice = MultimediaUtil.VideoInputDevices[combobox_CameraDeviceList.SelectedIndex];
        }
    }
}
